<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test</title>
</head>
<body>

<div id = 'sse'></div>

<script>
    let eventSource = new EventSource("/chat/SSE");
    eventSource.onmessage = function(event){
        document.getElementById("sse").innerHTML = event.data;
    }

    // ⾃定义事件
    sse.addEventListener("foo", (event)=>{
         document.getElementById("sse").innerHTML = event.data;
    });
    eventSource.addEventListener('end', function() {
         eventSource.close();
    });

    // let eventSource = new EventSource("/fluxDemo/sse");
    // eventSource.onmessage = function(event){
    //     document.getElementById("sse").innerHTML = event.data;
    // }


</script>

</body>
</html>